<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-5-22
 * Time: 下午9:16
 */
class MGirluser extends CI_Model{
    function __construct(){
        parent::__construct();
    }

    function inserGirlUser($uid,$girlId)
    {
        $this->deleteGirlUid($girlId);

        $uids = explode(',',$uid);

        $sqlArr = array();
        foreach($uids as $value){
            if(is_numeric($value)){
                $sqlArr[] = "($girlId,$value)";
            }
        }
        $sqlStr = implode(',',$sqlArr);
        $sql2 = "INSERT INTO `tbgirl_user`(`girl_id`,`uid`)VALUES $sqlStr";
        $this->db->query($sql2);

    }

    function deleteGirlUid($id)
    {
        $this->db->delete('tbgirl_user', array('girl_id' => $id));
    }
}